<?php

/**
 * delete a single author
 *
 * @author vbolshov
 */

include dirname(__FILE__) . '/../setup.php';

use bs\Book;

if ($id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT))
{
	$book = Book::find($id)->fetchOne();
} else {
	echo json_encode(array('success' => 0, 'message' => 'Invalid ID'));
	exit;
}

$book->delete();
echo json_encode(array('success' => 1));
exit;